package bojin.studio.weather.indicator;

import android.content.Context;
import android.net.ConnectivityManager;

public class networkStatus {
	Context mContext;
	public networkStatus(Context context)
	{
		mContext=context;
	}
	public boolean isConnect()
	{
	    ConnectivityManager conMan = (ConnectivityManager) mContext.getSystemService (Context.CONNECTIVITY_SERVICE); 
		
	    boolean mobile = conMan.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnected(); 
	    boolean wifi = conMan.getNetworkInfo (ConnectivityManager.TYPE_WIFI).isConnected();
		
		 if (wifi)  
		 {
			 //Toast.makeText(mContext, "Wifi", Toast.LENGTH_SHORT).show();
			 return true; 
		 }			  
		 else if (mobile)   
		 {
			// Toast.makeText(mContext, "3G", Toast.LENGTH_SHORT).show();
			 return true; 
		 }
		 else
		 {
			// Toast.makeText(mContext, "No Network", Toast.LENGTH_SHORT).show();
			 return false;
		 }
	}

}
